package com.fvff.sanctuary.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import java.io.Serializable;

/**
 * Name
 */
@Entity(name = "NAME")
public final class Name implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "NAME_ID")
    private Long id;

    @OneToOne(mappedBy = "name")
    private Person person;

    @Column(name = "ADDITIONAL_NAME")
    private String additionalName;

    @Column(name = "FAMILY_NAME")
    private String familyName;

    @Column(name = "GIVEN_NAME")
    private String givenName;

    @Column(name = "HONORIFIC_PREFIX")
    private String honorificPrefix;

    @Column(name = "HONORIFIC_SUFFIX")
    private String honorificSuffix;

    @Column(name = "UNSTRUCTURED")
    private String unstructured;

    public Name() {

    }

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public String getAdditionalName() {
        return additionalName;
    }

    public void setAdditionalName(final String additionalName) {
        this.additionalName = additionalName;
    }

    public String getFamilyName() {
        return familyName;
    }

    public void setFamilyName(final String familyName) {
        this.familyName = familyName;
    }

    public String getGivenName() {
        return givenName;
    }

    public void setGivenName(final String givenName) {
        this.givenName = givenName;
    }

    public String getHonorificPrefix() {
        return honorificPrefix;
    }

    public void setHonorificPrefix(final String honorificPrefix) {
        this.honorificPrefix = honorificPrefix;
    }

    public String getHonorificSuffix() {
        return honorificSuffix;
    }

    public void setHonorificSuffix(final String honorificSuffix) {
        this.honorificSuffix = honorificSuffix;
    }

    public String getUnstructured() {
        return unstructured;
    }

    public void setUnstructured(final String unstructured) {
        this.unstructured = unstructured;
    }

    @Override
    public boolean equals(final Object o) {
        return o != null && (o == this || o.getClass() == getClass() && EqualsBuilder.reflectionEquals(this, o));
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }
}